package a1_4;

/**
 * 支付宝支付（Payment子类）
 */
public class AliPay extends Payment {
    private String number; // 支付宝账号（卡号）

    public AliPay() {}

    public AliPay(double amount, String number) {
        super(amount);
        this.number = number;
    }

    // 实现父类抽象方法：验证支付宝有效性（简化逻辑）
    @Override
    public boolean validatePayment() {
        return number != null && (number.matches("1[3-9]\\d{9}") || number.contains("@"));
    }

    // Getter/Setter
    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }
}